import { defineStore } from 'pinia';
// import {ref,reactive} from "vue";
import {reactive} from "vue";
import PhraseOWordUsage from "@/models/PhraseOWordUsage";

export const useInputingStore=defineStore("inputingStore", {
  state: () => {
    return reactive({
      count:0,
      name:"test",
      pickInputingValue:"",
      iskeyingSettled:false,
      currFilledMoreThanOne:false,
      currTempPhraseOWord:new PhraseOWordUsage.PhraseOWord(new PhraseOWordUsage.WordMark(-1, null), new PhraseOWordUsage.WordMark(-1, null), null, false)
    })
    // return {
    //   hello: 'hello world',
    //   myList: [],
    //   reactList : reactive([]),
    //   refvalue:ref("")
    // }
  },
  getters:{
    some(state){
      // console.log("some!!");
      return state.pickInputingValue+"//"+1;
    }
  },
  actions:{
    testOnAction() {
      // console.log("testOnAction invoked");
      this.count++
      console.log(this.count)
      return Promise.resolve('这是testOnAction返回的值')
    },
    testOnAction2(...args) {
      // console.log("testOnAction2 invoked");
      console.log(...args)
      return Promise.reject('这是testOnAction222错误返回的值')
    }
  }
})